<?php

namespace app\shop\controller;


use app\common\service\GoodsBrandService\GoodsBrandService;
use app\Normal;
use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;

/**
 * 商品品牌
 * @Group("GoodsBrand")
 * @Middleware({shopMiddileware::class})
 */
class GoodsBrand extends \app\BaseShopController
{
    /**
     * 商品品牌列表
     * @Route("goodsBrandLists",method="GET")
     * @return void
     */
    public function goodsBrandLists(){
        $result = callApi(GoodsBrandService::class, 'goodsBrandLists',$this->_all_data);
        return apiResponse($result);
    }

    /**
     * 品牌详情
     * @Route("goodsBrandInfo/:id",method="GET")
     * @return void
     */
    public function goodsBrandInfo(){
        $result = callApi(GoodsBrandService::class, 'goodsBrandInfo',$this->_all_data);
        return apiResponse($result);
    }

    /**
     * 编辑商品品牌
     * @Route("editGoodsBrand",method="PUT")
     * @return void
     */
    public function editGoodsBrand(){
        $result = callApi(GoodsBrandService::class, 'editGoodsBrand',$this->_all_data);
        if($result['code'] == Normal::SUC){
            $this->log(['content'=>'修改商品品牌id为【'.$this->_all_data['id'].'】的信息','request_param'=> json_encode($this->_all_data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
        }
        return apiResponse($result);
    }
    /**
     * 商品品牌列表部分页
     * @Route("goodsBrandListsNoPage",method="GET")
     * @return void
     */
    public function goodsBrandListsNoPage(){
        $result = callApi(GoodsBrandService::class, 'goodsBrandListsNoPage',$this->_all_data);
        return apiResponse($result);
    }
}